package io.hxci.modules.tea.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.hxci.common.annotation.DataFilter;
import io.hxci.common.utils.Constant;
import io.hxci.common.utils.PageUtils;
import io.hxci.common.utils.Query;
import io.hxci.modules.tea.dao.TeaCommunicateMapper;
import io.hxci.modules.tea.domain.TeaCommunicate;
import io.hxci.modules.tea.service.TeaCommunicateService;
import org.springframework.stereotype.Service;

import java.util.Map;
@Service
public class TeaCommunicateServiceImpl extends ServiceImpl<TeaCommunicateMapper, TeaCommunicate> implements TeaCommunicateService {
    @Override
    @DataFilter(subDept = true, user = true, tableAlias = "u")
    public PageUtils queryPage(Map<String, Object> params) {
        String sql_filter = (String)params.get(Constant.SQL_FILTER);
        String username = (String)params.get("username");
        String deptId = (String)params.get("deptId");
        IPage<TeaCommunicate> page = new Query<TeaCommunicate>().getPage(params);
        page.setRecords(this.baseMapper.queryPage(page,sql_filter,username,deptId));
        return new PageUtils(page);
    }
}
